package com.power.project.dao;

import com.power.project.model.Ww_tag;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.io.Serializable;
import java.util.List;

/**
 * 标签 持久层(hibernate)
 */

public interface Ww_tagDao extends JpaRepository<Ww_tag, Serializable>, JpaSpecificationExecutor<Ww_tag>, Repository<Ww_tag, Serializable>, Ww_tagDaoCustom<Ww_tag, Serializable> {


    @Query("select w from Ww_tag w where w.tagid = ?1")
    Ww_tag getByTagId(String tagId);

    @org.springframework.transaction.annotation.Transactional
    @Modifying
    @Query("delete from Ww_tag w where w.tagid = ?1")
    int deleteByTagId(String tagId);

    @Query("select w from Ww_tag w where w.tenantid = ?1")
    List<Ww_tag> queryAllTagWechat(String tenantId);
}
